// we7/pages/mine/mineOrder.js
// we7/pages/pinTuan/PTIntegralExchange.js
// we7/pages/index/IntegralExchange.js
const app = getApp();
var sliderWidth = 96; // 需要设置slider的宽度，用于计算中间位置

Page({
  data: {
    tabs: ["全部", "待付款", "配送中", "待自提","待评价"],
    activeIndex: 0,
    sliderOffset: 0,
    sliderLeft: 0,
    orderarr:[],
    show: true,
    hidden: true,
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar
  },
  onLoad: function () {
    wx.setNavigationBarTitle({
      title: '我的订单',
    })
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2,
          sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex
        });
      }
    });
  },
  onReady: function () {
    this.toast = this.selectComponent("#toast");
  },
  tabClick: function (e) {
    this.setData({
      sliderOffset: e.currentTarget.offsetLeft,
      activeIndex: e.currentTarget.id
    });
  },
  showModal(e) {
    this.setData({
      modalName: e.currentTarget.dataset.target
    })
  },
  hideModal(e) {
    this.setData({
      modalName: null
    })
  },
  showPay: function () {
    this.toast.showToast();
    this.toast.hideToast();
    this.setData({
      modalName: null
    })
  },
 
  show: function () {
    var that = this;
    if (that.data.show == true) {
      that.setData({
        show: false,
        hidden: false,
      })
    } else {
      that.setData({
        show: true,
        hidden: true,
      })
    }
  },

  shows: function () {
    var that = this;
    if (that.data.hidden == false) {
      that.setData({
        hidden: true,
        show: true,
      })
    } else {
      that.setData({
        hidden: false,
        show: false,
      })
    }
  },
});

